<!DOCTYPE html>
<html>
<!-- 人员证书资质管理-编辑 -->

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
        <script src="/static/js/common.js"></script>

    <!-- <style>
        .el-icon-zoom-in {
            display: none;
        }

        .el-upload-list__item-delete {
            margin-left: -15px
        }
    </style> -->
</head>

<body>
    <div id="app" class="popupW100" v-cloak>
        <el-form label-position="right" :model="Form" status-icon :rules="rules" ref="ruleForm" label-width="100px"
            size="mini">
            <el-row>
                <el-col :span="11">
                    <!-- 人员名称 -->
                    <div class="elst-select-mini">
                        <el-form-item prop="PersonnelName">
                            <el-input type="text" v-model="Form.PersonnelName" autocomplete="off" size="mini">
                                <template slot="prepend">
                                    {{PersonnelCertificateQualificationManagement.PersonnelName+mark.m}}
                                </template>
                            </el-input>
                            <span class="iputLineMust" v-if="Form.PersonnelName.length<=0">
                                <!-- 必填项添加 -->
                                <img src="/static/images/exclamation.png" alt="">
                            </span>

                        </el-form-item>
                    </div>
                </el-col>
                <el-col :span="11" offset="2">
                    <!-- 性别 -->
                    <el-col>
                        <div class="elst-select-mini">
                            <el-form-item>
                                <el-input size="mini">
                                    <template slot="prepend">
                                        <div> {{PersonnelCertificateQualificationManagement.sex+mark.m}}</div>
                                    </template>
                                    <el-select @visible-change="visibleChange" v-model="Form.sex" slot="suffix"
                                        :placeholder="PersonnelCertificateQualificationManagement.sex">
                                        <el-option label="请选择" value=""></el-option>
                                        <el-option v-for="item in sex" :label="item.value" :value="item.key">
                                        </el-option>
                                    </el-select>
                                </el-input>
                            </el-form-item>
                        </div>
                    </el-col>
                </el-col>


                <el-col :span="11">
                    <el-form-item>
                        <div class="elst-select-mini" style="margin-left: -100px">
                            <el-input size="mini">
                                <template slot="prepend">
                                    {{PersonnelCertificateQualificationManagement.birthDate+mark.m}}
                                </template>
                                <el-date-picker slot="suffix" v-model="Form.birthDate" type="date" size="mini"
                                    format="yyyy-MM-dd" value-format="yyyy-MM-dd" placeholder="选择时间">
                                </el-date-picker>
                            </el-input>
                        </div>
                    </el-form-item>
                </el-col>

                <el-col :span="11" offset="2">
                    <!-- yearsOld -->
                    <div class="elst-select-mini">
                        <el-form-item prop="yearsOld">
                            <el-input disabled="true" type="text" v-model="yearsOld" autocomplete="off" size="mini">
                                <template slot="prepend">
                                    {{PersonnelCertificateQualificationManagement.yearsOld+mark.m}}
                                </template>
                            </el-input>
                        </el-form-item>
                    </div>
                </el-col>
                <el-col :span="11">
                    <!-- 证照编码 -->
                    <div class="elst-select-mini">
                        <el-form-item prop="LicenseCoding">
                            <el-input type="text" v-model="Form.LicenseCoding" autocomplete="off" size="mini">
                                <template slot="prepend">
                                    {{PersonnelCertificateQualificationManagement.LicenseCoding+mark.m}}
                                </template>
                            </el-input>

                        </el-form-item>
                    </div>
                </el-col>
                <el-col :span="11" offset="2">
                    <!-- 发证机关 -->
                    <div class="elst-select-mini">
                        <el-form-item prop="organ">
                            <el-input type="text" v-model="Form.organ" autocomplete="off" size="mini">
                                <template slot="prepend">
                                    {{PersonnelCertificateQualificationManagement.organ+mark.m}}
                                </template>
                            </el-input>
                        </el-form-item>
                    </div>
                </el-col>
                <el-col :span="11">
                    <!-- 证照名称 -->
                    <div class="elst-select-mini">
                        <el-form-item prop="Nameofcertificate">
                            <el-input type="text" v-model="Form.Nameofcertificate" autocomplete="off" size="mini">
                                <template slot="prepend">
                                    {{PersonnelCertificateQualificationManagement.Nameofcertificate+mark.m}}
                                </template>
                            </el-input>
                        </el-form-item>
                    </div>
                </el-col>
                <el-col :span="11" offset="2">
                    <!-- 证照类型 -->
                    <div class="elst-select-mini">
                        <el-form-item>
                            <el-input size="mini">
                                <template slot="prepend">
                                    <div> {{PersonnelCertificateQualificationManagement.Certificatetype+mark.m}}
                                    </div>
                                </template>
                                <el-select @visible-change="visibleChange" v-model="Form.Certificatetype" slot="suffix"
                                    :placeholder="PersonnelCertificateQualificationManagement.Certificatetype">
                                    <el-option label="请选择" value=""></el-option>
                                    <el-option v-for="item in Certificatetype" :label="item.value" :value="item.key">
                                    </el-option>
                                </el-select>
                            </el-input>
                        </el-form-item>
                    </div>
                </el-col>

                <el-col :span="11">
                    <el-form-item>
                        <div class="elst-select-mini" style="margin-left: -100px">
                            <el-input size="mini">
                                <template slot="prepend">
                                    {{PersonnelCertificateQualificationManagement.Issuancetime+mark.m}}
                                </template>
                                <el-date-picker slot="suffix" v-model="Form.Issuancetime" type="date" size="mini"
                                    format="yyyy-MM-dd" value-format="yyyy-MM-dd" placeholder="选择时间">
                                </el-date-picker>
                            </el-input>
                        </div>
                    </el-form-item>
                </el-col>
                <el-col :span="11" offset="2">
                    <el-form-item>
                        <div class="elst-select-mini" style="margin-left: -100px">
                            <el-input size="mini">
                                <template slot="prepend">
                                    {{PersonnelCertificateQualificationManagement.Termofvalidity+mark.m}}
                                </template>
                                <el-date-picker slot="suffix" v-model="Form.Termofvalidity" type="date" size="mini"
                                    format="yyyy-MM-dd" value-format="yyyy-MM-dd" placeholder="选择时间">
                                </el-date-picker>
                            </el-input>
                        </div>
                    </el-form-item>
                </el-col>
                <el-col :span="24">
                    <div class="elst-select-mini">
                        <el-form-item>
                            <div class="el-input--mini el-input-group">
                                <div class="el-input-group__prepend">
                                    {{PersonnelCertificateQualificationManagement.describe+mark.m}}
                                </div>
                                <el-input class="el-textarea__inner" type="textarea" v-model="Form.describe"
                                    autocomplete="off"></el-input>
                            </div>
                        </el-form-item>
                    </div>
                </el-col>
                <el-col :span="24">
                    <h3 style="font-size:12px;">{{PersonnelCertificateQualificationManagement.licence+mark.m}}</h3>
                    <!-- <el-upload class="avatar-uploader" style="width:180px;float:left;"
                        action="https://jsonplaceholder.typicode.com/posts/" :show-file-list="false"
                        :on-success="handleAvatarSuccess" :before-upload="beforeAvatarUpload">
                        <el-button type="primary">{{col.btnUpLoad}}</el-button>
                    </el-upload> 
                    <img v-if="imageUrl" :src="imageUrl" class="avatar">
                    <img src="/static/images/tp.jpg"
                        style="width:240px;height:178px;float:left;margin-left:15px;"
                        @click="UserInputStatistics" /><img src="/static/images/tp.jpg"
                        style="width:240px;height:178px;float:left;margin-left:15px;"> -->

                    <el-upload class="upload-demo" action="https://jsonplaceholder.typicode.com/posts/"
                        :on-preview="handlePreview" :on-remove="handleRemove" :file-list="fileList2"
                        list-type="picture-card">
                        <el-button size="small" type="primary">点击上传</el-button>
                    </el-upload>


                </el-col>
            </el-row>
            <el-row>
                <el-row type="flex" justify="end">
                    <el-form-item>
                        <el-button type="primary" @click="onSubmitForm('ruleForm')">{{col.btnSave}}</el-button>
                        <el-button type="primary" @click="onSubmitForm('ruleForm')">{{col.btnCommit}}</el-button>
                        <el-button type="primary" @click="parent.ListItem.dialogVisible=false">{{col.btnBack}}
                        </el-button>
                    </el-form-item>
                </el-row>
        </el-form>
        <!--user建议替换为表名 需要与resource文件夹下js 中的对象保持一致  -->
        <el-dialog title="人员证书资质管理" :visible.sync="ListItem.dialogVisible" @close='closeDialog' width="80%" height="80%"
            top="10vh">
            <iframe ref="iframe" :src="ListItem.InputUrl" style="height:280px;width:100%" frameborder="0"></iframe>
        </el-dialog>





    </div>
    <script type="text/javascript">

        var app = new Vue({

            el: '#app',
            data: {
                fileList2: [{ url: '/static/images/Client.png' }],
                //父业传参
                id: '',
                imageUrl: '',
                sex: [],
                organ: [],
                value1: '', radio: '1',
                ListItem: ListItem,
                Certificatetype: [],
                birthDate: '',
                yearsOld: '',
                year: '',
                formInline: {
                    model: {
                        PersonnelName: '',
                        Subordinatedepartments: '',
                        Nameofcertificate: '',
                        Issuancetime: '',
                        Maturitytime: '',
                        Certificatetype: '',
                        LicenseCoding: '',
                        Licensingauthority: '',
                        Termofvalidity: '',
                        describe: ''
                    },
                    offset: 0,
                    limit: 10
                },
                //业务表单内容
                Form: {
                    sex: '',
                    id: guidEmpty,
                    PersonnelName: '',
                    Subordinatedepartments: '',
                    Nameofcertificate: '',
                    Issuancetime: '',
                    Maturitytime: '',
                    Certificatetype: '',
                    LicenseCoding: '',
                    Licensingauthority: '',
                    Termofvalidity: '',
                    describe: ''
                },
                //表单验证
                rules: {

                    PersonnelName: [
                        verification.NotNull

                    ],
                    Subordinatedepartments: [
                        verification.NotNull
                    ],
                    Nameofcertificate: [
                        verification.NotNull
                    ],
                    Issuancetime: [
                        verification.NotNull
                    ],
                    Maturitytime: [
                        verification.NotNull
                    ],
                    Certificatetype: [
                        verification.NotNull
                    ],
                    LicenseCoding: [
                        verification.NotNull
                    ],
                    Licensingauthority: [
                        verification.NotNull
                    ],
                    Termofvalidity: [
                        verification.NotNull
                    ],
                    describe: [
                        verification.NotNull
                    ]
                }
            },
            updated: function () {
                if (this.Form.birthDate == undefined) {
                    this.yearsOld = 0
                    this.fileList2 = 0
                } else {
                    this.yearsOld = this.year - this.Form.birthDate.substring(0, 4)
                }
            },
            methods: {
                //解決edge下select bug
                visibleChange: function (isVisible) {
                    visibleChange(isVisible)
                },
                attrYear: function () {
                    var y = new Date().toString()
                    this.year = y.substring(11, 16)
                },
                getYearsOld: function () {
                    this.yearsOld = this.year - this.Form.birthDate.substring(0, 4)
                },
                handleRemove: function (file, fileList) {
                    console.log(file, fileList);
                },
                handlePreview: function (val, id) { DialogShow(this, val, "PersonnelCertificateQualificationManagementlistInput.html", id); },
                //上传图片
                handleAvatarSuccess: function (res, file) {
                    this.imageUrl = URL.createObjectURL(file.raw);
                },
                beforeAvatarUpload: function (file) {
                    const isJPG = file.type === 'image/jpeg';
                    const isLt2M = file.size / 1024 / 1024 < 2;

                    if (!isJPG) {
                        this.$message.error('上传头像图片只能是 JPG 格式!');
                    }
                    if (!isLt2M) {
                        this.$message.error('上传头像图片大小不能超过 2MB!');
                    }
                    return isJPG && isLt2M;
                },
                //获取分页数据
                GetPageData: function (currentIndex) { GetPageData(this, currentIndex, '/api/PersonnelCertificateQualificationManagement/GetList') },
                //查询方法
                onSubmit: function () { onSubmit(this); },
                btnUpLoad: function () {
                    this.$message({
                        message: '上传成功',
                        type: 'success'
                    });
                },
                //提交数据
                onSubmitForm: function (formName) {

                    var mythis = this;
                    this.$refs[formName].validate(function (valid) {
                        //验证通过
                        if (valid) {
                            onSubmitForm(this, '/api/PersonnelCertificateQualificationManagement/Save', mythis.Form);
                        } else {
                            //验证失败
                            return false;
                        }
                    });
                },
                getData: function () {
                    getData(this, '/api/PersonnelCertificateQualificationManagement/get?id=' + this.id);
                    this.Form.sex = this.Form.sex + "";
                },

                //删除方法
                onDelete: function () { onDelete(this, '/api/PersonnelCertificateQualificationManagement/DeleteMuti'); },
                //列表选择触发
                UserInputStatistics: function (val, id) { DialogShow(this, val, "PersonnelCertificateQualificationManagementlistPerson.html", id); },
                handleSelectionChange: function (val) { handleSelectionChange(this, val); },
                //获取分页数据
                GetPageData: function (currentIndex) { GetPageData(this, currentIndex, '/api/PersonnelCertificateQualificationManagement/GetList') },
                //pagesize改变 触发方法
                handleSizeChange: function (val) { handleSizeChange(this, val); },
                //跳页触发方法
                handleCurrentChange: function (val) { handleCurrentChange(this, val); },
            },
            mounted: function () {
                //初始化数据
                this.GetPageData(1);
                //列表高度自适应
                tablehigh(this);
                this.id = getUrlParam("id");
                this.sex = getDicData('01');
                this.yearsOld = Mock.mock({
                    "number|25-35": 35
                }).number;
                this.getData();
                //获取下拉菜单内容
                this.Certificatetype = getDicData('29');
                this.Trainingobjectives = getDicData('17');
                this.attrYear()
            }

        });
    </script>
</body>

</html>